<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('每日出勤情况登记列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>时间：</label>
                                <input type="text" class="time-input" placeholder="请选择时间" name="rq"/>
                            </li>
                            <li>
                                <label>班组：</label>
                                <select name="banz" th:with="type=${@dict.getType('gcgl_kqbanz')}">
                                	<option value="">----所有----</option>
					                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictLabel}"></option>
					            </select>
                            </li>
                            <li>
                                <label>带班：</label>
                                <input type="text" name="daib"/>
                            </li>
                            <li>
                                <label>编码：</label>
                                <input type="text" name="code"/>
                            </li>
                            <li>
                                <label>工程名称：</label>
                                <input type="text" name="projectName"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.addTab()" shiro:hasPermission="gcgl:kqworks:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.editTab()" shiro:hasPermission="gcgl:kqworks:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="gcgl:kqworks:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="gcgl:kqworks:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:src="@{/ruoyi/base64.min.js?v=20231208}"></script>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('gcgl:kqworks:edit')}]];
        var removeFlag = [[${@permission.hasPermi('gcgl:kqworks:remove')}]];
        var kqbanzdatas = [[${@dict.getType('gcgl_kqbanz')}]];
        var jcdatas = [[${@dict.getType('gcgl_jc')}]];
        var statusdatas = [[${@dict.getType('gcgl_status')}]];
        var prefix = ctx + "gcgl/kqworks";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "每日出勤情况登记",
                sortName: "id desc",
                sortOrder: "",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'rq',
                    title: '时间'
                },
                {
                    field: 'banz',
                    title: '班组',
                    formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(kqbanzdatas, item.banz);
		            }
                },
                {
                    field: 'daib',
                    title: '带班'
                },
                {
                    field: 'code',
                    title: '编码'
                },
                {
                    field: 'projectName',
                    title: '工程名称',
                    width:500
                },
                {
                    field: 'jc',
                    title: '假/车',
                    formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(jcdatas, item.jc);
		            }
                },
                {
                    field: 'count',
                    title: '人数'
                },
                {
                    field: 'descs',
                    title: '出工情况'
                },
                {
                    field: 'jig',
                    title: '记工'
                },
                {
                    field: 'zlwj',
                    title: '附件',
                    formatter: function(value, item, index) {
//                     	var url = "http://lkgnews.cn:8012/onlinePreview?url="+encodeURIComponent(Base64.encode(item.zlwj));
		            	var url = item.zlwj;
		            	return "<a target='_blank' href="+url+">查看</a>";
		            }
                },
                {
                    field: 'status',
                    title: '状态',
                    formatter: function(value, item, index) {
		            	return $.table.selectDictLabel(statusdatas, item.status);
		            }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
    </script>
</body>
</html>